package org.bookr.engine.service;

import org.bookr.engine.model.*;
import org.springframework.security.core.userdetails.UsernameNotFoundException;

import java.util.List;

/**
 * @author Pawel Tomaszewski
 */
public interface BookrService {

    List<Administrator> listAdministrators();
    List<Author> listAuthors();
    List<Book> listBooks();
    List<Category> listCategories();
    List<Comment> listComments();
    List<Group> listGroups();
    List<Reader> listReaders();
    List<Book> fetchRandomBooks(Integer count);

    AuthenticablePerson loadUserByUsername(String username);

    Administrator loadAdministratorById(String id);
//    Administrator loadAdministratorByUsername(String username) throws UsernameNotFoundException;
    Author loadAuthor(String id);
    Book loadBook(String id);
    Category loadCategory(String id);
    Comment loadComment(String id);
    Group loadGroup(String id);
    Reader loadReaderByUsername(String username);
    Reader loadReaderById(String id);

    String updateAdministrator(Administrator administrator);
    String updateAuthor(Author author);
    String updateBook(Book book);
    String updateCategory(Category category);
    String updateComment(Comment comment);
    String updateGroup(Group group);
    String updateReader(Reader reader);

//    String saveAdministrator(Administrator administrator);
//    String saveAuthor(Author author);
//    String saveBook(Book book);
//    String saveCategory(Category category);
//    String saveComment(Comment comment);
//    String saveGroup(Group group);
//    String saveReader(Reader reader);

    void removeAdministrator(Administrator administrator);
    void removeAuthor(Author author);
    void removeBook(Book book);
    void removeCategory(Category category);
    void removeComment(Comment comment);
    void removeGroup(Group group);
    void removeReader(Reader reader);

}
